# import time
#
# # 单层
# def metric(fn):
#     start_time = time.time()
#     fn()
#     end_time = time.time()
#     print('耗时：{:.4f}s'.format(end_time - start_time))
#     return fn
#
# @metric
# def now():
#     time.sleep(1)
#     now_time = time.asctime()
#     print(now_time)
#
# now()
# bb = metric(print_score)
# bb()


import time

# 双层
def metric(fn):
    def ptime(*args, **kw):
        start_time = time.time()
        fn(*args, **kw)
        end_time = time.time()
        print('耗时：{:.4f}s'.format(end_time - start_time))
        return fn
    return ptime


@metric
def now():
    time.sleep(1)
    now_time = time.asctime()
    print(now_time)


now()
